// 导入：类型、接口、模块、组件、样式
import { Component } from "react";

import Login from "./pages/login"; // pages/login.tsx   pages/login/index.tsx
import Home from "./pages/home"; // pages/index.tsx   pages/index/index.tsx
import ClassState from "./study/01-类组件状态"; // pages/index.tsx   pages/index/index.tsx
import FunState from "./study/02-函数组件状态";
import ClassSync from "./study/05-setState异步同步18版本";
import ClassMerge from "./study/07-setState合并";
import Attr from "./study/08-组件属性";
import MergeEvent from "./study/09-合成事件";
import MergeEvent2 from "./study/10-合成事件传参";

import "./styles/reset.scss";

class Index extends Component {
  render() {
    // 模拟路由
    const path = window.location.href.split("/").pop();
    // 返回数据
    return (
      <>
        {path === "" && <Home />}
        {path === "login" && <Login />}
        {path === "classState" && <ClassState />}
        {path === "funState" && <FunState />}
        {path === "classSync" && <ClassSync />}
        {path === "classMerge" && <ClassMerge />}
        {path === "attr" && <Attr a="1" b={2} />}
        {path === "mergeEvent" && <MergeEvent />}
        {path === "mergeEvent2" && <MergeEvent2 />}
      </>
    );
  }
}
export default Index;
